package com.njbw.minio.config;

import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "minio")
public class MinioProperties {

    /**
     * 文件服务地址
     */
    private String endpoint;

    /**
     * 文件服务器账号
     */
    private String accessKey;

    /**
     * 文件服务认证信息
     */
    private String secretKey;

    /**
     * 存储桶名称
     */
    private String bucket;

    public String getEndpoint() {
        return endpoint;
    }

    public void setEndpoint(String endpoint) {
        if (StringUtils.isBlank(endpoint)) {
            throw new IllegalArgumentException("minio 服务器地址不能为空！");
        }
        this.endpoint = endpoint;
    }

    public String getAccessKey() {
        return accessKey;
    }

    public void setAccessKey(String accessKey) {
        if (StringUtils.isBlank(accessKey)) {
            throw new IllegalArgumentException("minio 服务器账号不能为空！");
        }
        this.accessKey = accessKey;
    }

    public String getSecretKey() {
        return secretKey;
    }

    public void setSecretKey(String secretKey) {
        if (StringUtils.isBlank(secretKey)) {
            throw new IllegalArgumentException("minio 服务器密码不能为空！");
        }
        this.secretKey = secretKey;
    }

    public String getBucket() {
        return bucket;
    }

    public void setBucket(String bucket) {
        if (StringUtils.isBlank(bucket)) {
            throw new IllegalArgumentException("minio 存储桶不能为空！");
        }
        this.bucket = bucket;
    }
}
